const program = require('commander');

const { createAction, addComponentAction, addPageAndRouteAction, addStoreAction } = require('./action')

const createCommands = () => {
    program
        .command('create <project> [others...]')
        .description('自动创建项目')
        .action(createAction)

    program
        .command('addcpn <name>')
        .description('自动创建组件')
        .action((name) => {
            addComponentAction(name, program.dest || 'src/components');
        })

    program
        .command('addpage <page>')
        .description('自动创建页面')
        .action((page) => {
            addPageAndRouteAction(page, program.dest || 'src/pages');
        })

    program
        .command('addstore <store>')
        .description('自动创建store')
        .action((store) => {
            addStoreAction(store, program.dest || 'src/store/modules');
        })
}

module.exports = createCommands